home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
smaltalk
/
manchest.lha
/
MANCHESTER
/
manchester
/
2.2
/
obscured-subviews.st
< prev
next >
Wrap
Text File
|
1993-07-24
|
5KB
|
183 lines
" NAME obscured-subviews
AUTHOR neild@cs.man.ac.uk
FUNCTION subview obscured by superview is seen
ST-VERSIONS 2.2
PREREQUISITES
CONFLICTS
DISTRIBUTION world
VERSION 1.1
DATE 22 Jan 1989
SUMMARY obscured-subviews
(neild) ""fixes so that a sub view obscured by its
super view will display properly.""(2.2)
"!
!View methodsFor: 'display transformation'!
displayScale: numberOrPoint
"Apply the display transformation's scale of the receiver to numberOrPoint
and answer the resulting scaled object."
^(numberOrPoint * self displayTransformation scale) rounded! !
!View methodsFor: 'window access'!
insetWindow
"Answer my window inset by my, inverse display scaled, border widths."
^self getWindow
insetBy: (self borderWidths scaleBy: self displayTransformation inverseScale)! !
!View methodsFor: 'displaying'!
displaySafe: aBlock
"Do nothing if the receiver is the top view (see StandardSystemView) else
ask the receiver's super view to safely display aBlock. Sub classes may
reimplement this to cater for overlapping views and/or caching etc. Safe display
means that overlapping views are not corrupted, amongst other things.
aBlock should only alter the Display."
self isTopView
ifTrue: [ aBlock value ] "better than an infinite loop"
ifFalse: [ self superView displaySafe: aBlock for: self ]! !
!View methodsFor: 'display box access'!
windowDisplayBox
"Answer the region in Display coordinates corresponding to my window;
without regard to the insetDisplayBox of any super view."
^self displayTransform: self window! !
!View methodsFor: 'window access'!
insetDisplayWindow
"Answer the region in the window coordinate system corresponding to my
inset display box."
^self inverseDisplayTransform: self insetDisplayBox! !
!View methodsFor: 'display box access'!
insetWindowDisplayBox
"Answer my windowDisplayBox inset by my border widths."
^self windowDisplayBox insetBy: self borderWidth! !
!View methodsFor: 'displaying'!
displaySafe: aBlock for: aSubView
"Do nothing if the receiver is the top view (see StandardSystemView) else
ask the receiver's super view to safely display aBlock. Sub classes may
reimplement this to cater for overlapping views and/or caching etc. Safe display
means that overlapping views are not corrupted, amongst other things.
aBlock should only alter the Display."
self displaySafe: aBlock!
displayView
"Subclasses should redefine View|displayView in order to display particular
objects associated with the View such as labels, lines, boxes, etc."
self isInsetDisplayBoxValid ifFalse: [ ^self ].
^self! !
!View methodsFor: 'testing'!
isDisplayBoxValid
^self displayBox corner > (self displayBox origin)! !
!View methodsFor: 'displaying'!
displayBorder
"Display the receiver's border (using the receiver's borderColor)."
self isDisplayBoxValid ifFalse: [ ^self ].
self borderWidth = 0
ifTrue:
[self insideColor == nil
ifFalse:
[Display fill: self displayBox mask: self insideColor]]
ifFalse:
[superView isNil
ifTrue: [Display
border: self displayBox
widthRectangle: self borderWidth
mask: borderColor]
ifFalse: [Display
border: self windowDisplayBox
widthRectangle: self borderWidth
mask: borderColor
clippingBox: superView insetDisplayBox].
(self insideColor notNil and: [ self isInsetDisplayBoxValid ])
ifTrue: [Display fill: self insetDisplayBox mask: self insideColor]]! !
!View methodsFor: 'bordering'!
borderWidths
"Answer a Rectangle whose
left value is the width in display coordinates of the receiver's left border.
Right, top, and bottom widths are analogous.
The border width is initially 0. A View with a border width of 0 will not have
any border displayed."
^borderWidth = 0 ifTrue: [ 0@0 extent: 0@0 ] ifFalse: [ borderWidth ]! !
!View methodsFor: 'testing'!
isInsetDisplayBoxValid
^self insetDisplayBox corner > (self insetDisplayBox origin)! !
!ScrollController methodsFor: 'initialize-release'!
initialize
super initialize.
scrollBar _ Quadrangle new.
scrollBar borderWidthLeft: 2 right: 1 top: 2 bottom: 2.
marker _ Quadrangle new.
marker insideColor: Form gray! !
!StandardSystemView class methodsFor: 'instance creation'!
model: aModel label: labelText minimumSize: minimumSize
| view |
view _ self new.
view model: aModel.
view label: labelText.
view minimumSize: minimumSize.
view borderWidth: 2.
^view! !
!TextView methodsFor: 'displaying'!
display
"Show the text of the receiver on the display screen."
self isUnlocked
ifTrue:
[self controller
wrappingBox: self wrappingBox
clippingBox: self insetDisplayBox.
(controller text isEmpty and: [controller textHasChanged not])
ifTrue: [self newText: self getText]].
super display!
displayView
self isUnlocked ifTrue:
[self controller
wrappingBox: self wrappingBox
clippingBox: self insetDisplayBox ].
self isInsetDisplayBoxValid ifFalse: [ ^self ].
self clearInside.
self controller display!
wrappingBox
"Answer a Rectangle to be used as the composition rectangle
of the paragraph."
^self insetWindowDisplayBox insetBy: 6@0! !